﻿@using lwzlz.Core;
@{
    Layout = "~/Views/Shared/_LayuiLayout.cshtml";
    var orderDetailList = ViewData["orderDetailList"] as List<OrderDetailOutput>;
    var orderAddress = ViewData["orderAddress"] as OrderAddress;
}

@model OrderOutput

<form class="layui-form layui-form-pane">
    @Html.AntiForgeryToken()
    <input type="hidden" value="@Model.Id" name="Id" />
    <div class="layui-form-item">
        <label class="layui-form-label">用户名</label>
        <div class="layui-input-block">
            <input type="text" class="layui-input" name="MemberUserName" value="@ViewBag.MemberUserName">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">用户姓名</label>
        <div class="layui-input-block">
            <input type="text" class="layui-input" name="MemberRealName" value="@ViewBag.MemberRealName">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">订单编号</label>
        <div class="layui-input-block">
            <input type="text" class="layui-input" name="Code" value="@Model.Code">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">状态</label>
        <div class="layui-input-block">
            <select name="Status" lay-verify="">
                <option value="" selected="">请选择</option>
                <option value="10" @(Model.Status == 10 ? "selected=selected" : "")>待支付</option>
                <option value="20" @(Model.Status == 20 ? "selected=selected" : "")>已支付</option>
                <option value="30" @(Model.Status == 30 ? "selected=selected" : "")>待发货</option>
                <option value="40" @(Model.Status == 40 ? "selected=selected" : "")>发货成功</option>
                <option value="90" @(Model.Status == 90 ? "selected=selected" : "")>订单取消</option>
            </select>
            <div class="layui-form-select layui-form-selected">
                <div class="layui-select-title">
                    <input type="text" placeholder="请选择" value="" readonly="" class="layui-input"><i class="layui-edge"></i>
                </div>
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">总金额</label>
        <div class="layui-input-block">
            <input type="text" class="layui-input" name="Code" value="@Model.TotalAmount">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">下单时间</label>
        <div class="layui-input-block">
            <input type="text" class="layui-input" name="OrderTime" value="@Model.OrderTime">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">发货姓名</label>
        <div class="layui-input-block">
            <input type="text" class="layui-input" name="RealName" value="@orderAddress.RealName">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">手机号</label>
        <div class="layui-input-block">
            <input type="text" class="layui-input" name="Mobile" value="@orderAddress.Mobile">
        </div>
    </div>
    <div class="layui-inline">
        <label class="layui-form-label">省份</label>
        <div class="layui-input-inline">
            <div class="row">
                <input type="text" class="layui-input" name="ProvinceName" value="@orderAddress.ProvinceName">
            </div>
        </div>
    </div>
    <div class="layui-inline">
        <label class="layui-form-label">城市</label>
        <div class="layui-input-inline">
            <div class="row">
                <input type="text" class="layui-input" name="CityName" value="@orderAddress.CityName">
            </div>
        </div>
    </div>
    <div class="layui-form-item" style="margin-top:15px;">
        <label class="layui-form-label">详细地址</label>
        <div class="layui-input-block">
            <input type="text" class="layui-input" name="SendAddress" value="@orderAddress.SendAddress">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">邮编</label>
        <div class="layui-input-block">
            <input type="text" class="layui-input" name="PostCode" value="@orderAddress.PostCode">
        </div>
    </div>
    <div>
        @if (orderDetailList != null)
        {
            <div class="layui-tab-content">
                <div class="layui-tab-item layui-show">
                    <table class="layui-table layuiadmin-page-table" lay-skin="line">
                        <thead>
                            <tr>
                                <th>名称</th>
                                <th>编号</th>
                                <th>分类</th>
                                <th>单价</th>
                                <th>数量</th>
                                <th>金额</th>
                            </tr>
                        </thead>
                        <tbody>
                            @foreach (var item in orderDetailList)
                            {
                                <tr>
                                    <td><span>@item.CommodityName</span></td>
                                    <td><span>@item.CommodityCode</span></td>
                                    <td><span>@item.CategoryName</span></td>
                                    <td><span>@item.CommodityMoney</span></td>
                                    <td><span>@item.Number</span></td>
                                    <td><span>@item.TotalMoney</span></td>
                                </tr>
                            }
                        </tbody>
                    </table>
                </div>
            </div>
        }
    </div>
    <div class="layui-form-item" align="center">
        <button type="button" class="layui-btn layui-btn-primary" id="btnCancel">取消</button>
    </div>
</form>

@section scripts{
    <script type="text/javascript">
        var $, layer;
        layui.use(['form'], function () {
            var form = layui.form;
            $ = layui.jquery;
            layer = parent.layer === undefined ? layui.layer : parent.layer;

            // 监听关闭
            $('#btnCancel').on('click', function () {
                layer_close();
            });
        });
    </script>
}

